# -*- coding: UTF-8 -*-
"""
@Filename:exerc2.py
@author:Cora
@time:2025-04-18
"""
import requests
import os

url = 'http://n.sinaimg.cn/news/crawl/117/w550h367/20220417/a3a9-08b2ca6dffe4210149dda424adf0734f.jpg'

save_path = os.path.join('C:/Users/32683/Desktop', 'downloaded_image.jpg')

response = requests.get(url)
if response.status_code == 200:
    with open(save_path, 'wb') as file:
        file.write(response.content)
    print('图片下载成功')
else:
    print('图片下载失败')